package yi;

import java.io.*;

public class NumberThree {
    public static void main(String[] args) {
        File file=new File("G:/file/test");
        File copfile=new File("G:/file/test1");
        File[] files = file.listFiles();
        for (File file1 : files) {
            cop(file1,copfile,file1.getName());
        }


    }
    public static void cop(File file,File file1,String name){
        try(
                FileInputStream fileInputStream=new FileInputStream(file);
                FileOutputStream fileOutputStream=new FileOutputStream(new File(file1,name));
                ) {
            byte[] bytes=new byte[1024];
            int len=-1;
            while((len=fileInputStream.read(bytes))!=-1){
                fileOutputStream.write(bytes,0,len);
            }
        }catch (IOException e){
            e.printStackTrace();
        }

    }
}
